import request from '@/config/axios'
import dayjs from "dayjs";
import {DataComparisonRespVO} from "@/api/mall/statistics/common";
import {formatDate} from "@/utils/formatTime";
import {TradeOrderTrendRespVO} from "@/api/mall/statistics/trade";

export interface RegisterVO {
  id: number
  userId: string
  regDate: string
  patientId: string
  patientName: string
  cardTypeId: string
  cardNo: string
  regTypeId: string
  regType: string
  departmentId: string
  departmentName: string
  doctorId: string
  doctorName: string
  scheduleId: string
  scheduleName: string
  clinicCode: string
  totalCost: string
  payTypeID: string
  payModeName: string
  openBank: string
  openAccount: string
  amount: string
  settleDes: string
  tradeSerialNumber: string
  createTime: Date
  seeNo: string
  clinicNo: string
  number: string
  sequence: string
  procedureStatus: string
  procedureTime: string
  payStatus: string
  payTime: string
  registerNo: string

  procedureId: string
  procedureNo: string
  barcode: string

}

// 首页
export const index = () => {
  return request.get({ url: '/bh/statics/index' })
}

export const payCount = (params) => {
  return request.get({ url: '/bh/statics/payCount', params  })
}

export const patientCount = (params) => {
  return request.get({ url: '/bh/statics/patient/count', params  })
}

export const bizCount = (params) => {
  return request.get({ url: '/bh/statics/biz/count', params  })
}

// 获得订单量趋势统计
export const getPayCount = (
  type: number,
  beginTime: dayjs.ConfigType,
  endTime: dayjs.ConfigType
) => {
  return request.get<DataComparisonRespVO<TradeOrderTrendRespVO>[]>({
    url: '/bh/statics/payCount',
    params: { type, beginTime: formatDate(beginTime), endTime: formatDate(endTime) }
  })
}

export const getPayTypeCount = (
  type: number,
  beginTime: dayjs.ConfigType,
  endTime: dayjs.ConfigType
) => {
  return request.get<DataComparisonRespVO<TradeOrderTrendRespVO>[]>({
    url: '/bh/statics/payTypeCount',
    params: { type, beginTime: formatDate(beginTime), endTime: formatDate(endTime) }
  })
}

// 查询病人档案
export const getPatientPage = (params: PageParam) => {
  return request.get({ url: '/bh/statics/patient/list', params })
}

// 查询挂号记录
export const getRegisterPage = (params: PageParam) => {
  return request.get({ url: '/bh/statics/register/list', params })
}

// 查询门诊缴费账单
export const getBillPage = (params: PageParam) => {
  return request.get({ url: '/bh/statics/outpatient/bill', params })
}

// 查询门诊缴费记录
export const getOutpatientPage = (params: PageParam) => {
  return request.get({ url: '/bh/statics/outpatient/list', params })
}

// 查询费用明细
export const getPriceList = (params: PageParam) => {
  return request.get({ url: '/bh/statics/outpatient/price', params })
}

// 查询处方签二维码
export const getQrPage = (params: PageParam) => {
  return request.get({ url: '/bh/statics/outpatient/qr', params })
}

// 查询挂号记录
export const getInHospitalPage = (params: PageParam) => {
  return request.get({ url: '/bh/statics/inhospital/list', params })
}


// 查询对账单
export const getBill = (params: PageParam) => {
  return request.get({ url: '/bh/statics/bill', params })
}

// 查询医保移动支付对账单
export const getChsBill = (params: PageParam) => {
  return request.get({ url: '/bh/statics/chs/bill', params })
}

